DEF fh, nl:PTR TO INT, fl, chr:PTR TO CHAR, tmp=0:PTR TO CHAR,
pos=0:PTR TO CHAR, tstg:PTR TO CHAR, pstg:PTR TO CHAR, flname:PTR TO CHAR,
cnt=0:PTR TO CHAR, pc=0:PTR TO CHAR, lc=0:PTR TO CHAR, ccn=0:PTR TO CHAR,
frq=0:PTR TO CHAR, nsw:PTR TO CHAR, tlo=0:PTR TO CHAR
chr:=String(4)
StrCopy(chr, ' ', ALL)
nsw:=String(4)
StrCopy(nsw, ' ', ALL)
tstg:=String(25)
StrCopy(tstg, ' ', ALL)
pstg:=String(50)
StrCopy(pstg, ' ', ALL)
flname:=String(100)
StrCopy(flname, ' ', ALL)
StrCopy(flname, aslBuf, ALL)
IF lft=8
StrAdd(flname, 'FNSpeech.Lgui', ALL)
ELSEIF lft=9
StrAdd(flname, 'FSSpeech.Lgui', ALL)
ENDIF
IF trns=1
IF (translatorbase:=OpenLibrary('translator.library', 37))<>0
tlo:=1
ELSE
WriteF('\nERROR: Translator.Library, V37 or Higher, was Not Found.\n')
ENDIF
ENDIF
WriteF('\n*** SPEECH FILE - \s ***\n\n', flname)
fl:=FileLength(flname)
IF fl>21
tmp:=NewM(fl, MEMF_PUBLIC OR MEMF_CLEAR)
IF fh:=Open(flname, MODE_OLDFILE)
nl:=Read(fh, tmp, fl)
Close(fh)
IF nl=fl
IF Char(tmp)<>64
WriteF('\nThe @ Character Is Missing.\n')
Raise(ERR_CHDV)
ELSE
FOR z:=1 TO 4 DO chr[z]:=Char(tmp+z)
frq:=Val(chr)
IF ((frq<1) OR (frq>1500))
WriteF('\nThe NUMBER OF SYLLABLE LINES You Have Declared Is Not In The Correct\nRange Of 1-1500.\n\nYou Have Incorrectly Declared: \d\n', frq)
Raise(ERR_CHDV)
ELSE
pos:=6
ENDIF
ENDIF
WHILE cnt<frq
ccn:=0
StrCopy(tstg, ' ', ALL)
StrCopy(pstg, ' ', ALL)
WHILE (vle:=Char(tmp+pos))<>10
IF ccn>=25
WriteF('\nSYLLABLE LINE \d Is More Than 25 Characters Long.\n', cnt+1)
Raise(ERR_CHDV)
ELSE
IF vle>31
tstg[ccn]:=vle
INC pos
INC ccn
ELSE
WriteF('\nSYLLABLE LINE \d Has An Invalid Character Inside It - Chr$(\d).\n\nPosition = \d\n\nN.B: Characters Below Chr$(32) Are Not Allowed.\n', cnt+1, vle, ccn+1)
Raise(ERR_CHDV)
ENDIF
ENDIF
ENDWHILE
IF ((ccn=0) AND ((Char(tmp+pos))=10))
WriteF('\nSYLLABLE LINE \d Is Not Valid.\n\nN.B: Empty Syllable Lines Are Not Allowed.\n', cnt+1)
WriteF('\nThe SPEAKING SENTENCE TO BE ACTIVATED (Position/Line: \d), (Value:\s),\nIs Not In YOUR Range Of 1-\d\n', cnt+1, chr, ycr)
Raise(ERR_CHDV)
ENDIF
WHILE (Char(tmp+pos))<>42
IF pc>=25
WriteF('\nYou Have Declared More Than 25 SYLLABLE LINES TO USE.\n\nThe SPEAKING SENTENCE TO BE ACTIVATED Is:\s - Check Its SYLLABLE LINES.\n', chr)
Raise(ERR_CHDV)
ELSE
FOR z:=0 TO 3 DO nsw[z]:=Char(tmp+pos+z)
vle:=Val(nsw)
IF ((vle>0) AND (vle<=Min(frq, 1500)))
INC pc
pos:=pos+4
ELSE
WriteF('\nYou Have An Invalid Value For One Of Your SYLLABLE LINES TO USE.\n\nThe SPEAKING SENTENCE TO BE ACTIVATED Is:\s.\n\nYour Invalid SYLLABLE LINE TO USE Is: \s (At Number/Line Position: \d)\n', chr, nsw, pc+1)
Raise(ERR_CHDV)
ENDIF
ENDIF
ENDWHILE
pos:=pos+2
INC cnt
ENDWHILE
WriteF('\n....Checking Finished.\n')
IF ((trns=1) AND (tlo=1))
WriteF('\nN.B: Make sure the Length of any Translated (Phonetic) text line is\n no longer than 25 Characters.')
ENDIF
ELSE
WriteF('\nERROR: \s was only Partly Read.\n', flname)
Raise(ERR_CHDV)
ENDIF
ELSE
WriteF('\nERROR: \s was Not Opened.\n', flname)
Raise(ERR_CHDV)
ENDIF
ELSEIF ((fl>=0) AND (fl<22))
WriteF('\nERROR: \s was Too Small.\n', flname)
Raise(ERR_CHDV)
ELSE
WriteF('\nERROR: \s was Not Found.\n', flname)
Raise(ERR_CHDV)
ENDIF
IF tstg THEN DisposeLink(tstg)
IF pstg THEN DisposeLink(pstg)
IF chr THEN DisposeLink(chr)
IF nsw THEN DisposeLink(nsw)
IF flname THEN DisposeLink(flname)
IF translatorbase<>0 THEN CloseLibrary(translatorbase)
ENDPROC
PROC checkWordFile()
DEF pos=0:PTR TO CHAR, cnt=0:PTR TO CHAR, fh, nl:PTR TO INT, fl,
chr:PTR TO CHAR, rnge=0:PTR TO INT, pcnt=0:PTR TO CHAR, tmp=0:PTR TO CHAR,
flname:PTR TO CHAR, nsw:PTR TO CHAR, ccnt=1:PTR TO CHAR
WriteF('\nThe @ character is missing from Category: \d\n', ccnt)
Raise(ERR_CHDV)
ELSE
FOR z:=1 TO 4 DO chr[z]:=Char(tmp+pos+z)
vle:=Val(chr)
IF vle<=0
WriteF('\nThe NUMBER OF DECLARED SENTENCE LINES in Category: \d is invalid.\n', ccnt)
Raise(ERR_CHDV)
ENDIF
IF ((lft>=0) AND (lft<2))
rnge:=vle*2
ELSE
rnge:=vle
ENDIF
ENDIF
pos:=pos+6
cnt:=0
WHILE cnt<rnge
pcnt:=0
WHILE (vle:=Char(tmp+pos+pcnt))<>10
IF pcnt>=42
WriteF('\nYou have too many characters in Sentence Line: \d / Category: \d\n', cnt+1, ccnt)
Raise(ERR_CHDV)
ENDIF
IF vle<32
WriteF('\nINVALID CHARACTER in Sentence Line: \d\n', cnt+1)
Raise(ERR_CHDV)
ENDIF
INC pcnt
ENDWHILE
IF pcnt=0
WriteF('\nSentence Line: \d / Category: \d is invalid.\n\nN.B: EMPTY Sentence Lines are not allowed - A Sentences Line must contain\n exactly 42 characters.\n', cnt+1, ccnt)
Raise(ERR_CHDV)
ENDIF
pos:=pos+43
INC cnt
ENDWHILE
IF (vle:=Char(tmp+pos))=42
pos:=pos+2
INC ccnt
ELSE
WriteF('\nThe * END MARKER is missing from Category: \d\n\nIf your * END MARKER is present, Check that you have declared\nthe right number of Sentence Lines.', ccnt)
Raise(ERR_CHDV)
ENDIF
UNTIL pos>=fl
IF ccnt<>23
WriteF('\nYou have \d Categories - LGUI Text Files MUST have exactly\n22 Categories in them.\n', ccnt-1)
Raise(ERR_CHDV)
ENDIF
ELSE
WriteF('\nERROR: \s was only Partly Read.\n', flname)
Raise(ERR_CHDV)
ENDIF
ELSE
WriteF('\nERROR: \s was Not Opened.\n', flname)
Raise(ERR_CHDV)
ENDIF
ELSEIF ((fl>=0) AND (fl<2068))
WriteF('\nERROR: \s was Too Small.\n', flname)
Raise(ERR_CHDV)
ELSE
WriteF('\nERROR: \s was Not Found.\n', flname)
Raise(ERR_CHDV)
ENDIF
IF chr THEN DisposeLink(chr)
IF nsw THEN DisposeLink(nsw)
IF flname THEN DisposeLink(flname)
WriteF('\n....Checking Finished.\n')
ENDPROC
PROC checkTitles()
DEF pos=0:PTR TO CHAR, fh, nl:PTR TO INT, fl, tmp=0:PTR TO CHAR,
flname:PTR TO CHAR, ccnt=1:PTR TO CHAR
flname:=String(100)
StrCopy(flname, ' ', ALL)
StrCopy(flname, aslBuf, ALL)
StrAdd(flname, 'Titles.Lgui', ALL)
WriteF('\n*** TITLES FILE - \s ***\n\n', flname)
fl:=FileLength(flname)
IF fl=1276
tmp:=NewM(fl, MEMF_PUBLIC OR MEMF_CLEAR)
IF fh:=Open(flname, MODE_OLDFILE)
nl:=Read(fh, tmp, fl)
Close(fh)
IF nl=fl
REPEAT
WriteF('\nChecking Title: \d\n', ccnt)
FOR z:=0 TO 27
IF Char(tmp+pos+z)<32
WriteF('\nTitle \d - Character \d is Invalid.\n', ccnt, z)
Raise(ERR_CHDV)
ENDIF
ENDFOR
pos:=pos+28
IF Char(tmp+pos)<>10
WriteF('\nTitle \d - The RETURN/ENTER Character is missing, from the end of the line.\n', ccnt)
Raise(ERR_CHDV)
ENDIF
INC ccnt
INC pos
UNTIL pos>=fl
IF ccnt<>45
WriteF('\nYou have \d Titles - The LGUI Titles File MUST have exactly\n44 Titles in it.\n', ccnt-1)
Raise(ERR_CHDV)
ENDIF
ELSE
WriteF('\nERROR: \s was only Partly Read.\n', flname)